import 'package:flutter/material.dart';

import 'package:get/get.dart';
import 'package:zrjz/comm/base/base_stateless_page.dart';
import 'package:zrjz/comm/utils/ext_dart.dart';
import 'package:zrjz/comm/utils/log_utils.dart';
import 'package:zrjz/comm/widget/webview_page.dart';
import 'package:zrjz/router/page_router.dart';

class GlobalWebPage extends BaseStatelessPage {
  GlobalWebPage({super.key});

  //启动当前页面
  static void startInstance(
    String title,
    String url, {
    bool isShowAppBar = true,
  }) {
    return Get.start(RouterPath.GLOBAL_WEB, arguments: {'title': title, 'initialUrl': Uri.encodeFull(url), 'isShowAppBar': isShowAppBar});
  }

  @override
  GetxController createRawController() {
    throw UnimplementedError();
  }

  @override
  void initState() {}

  @override
  Widget buildWidget(BuildContext context) {
    bool isShowAppBar = Get.arguments['isShowAppBar'];
    String initialUrl = Get.arguments['initialUrl'];
    String title = Get.arguments['title'];
    Log.d("PrivacyPolicePage 的参数 isShowAppBar：$isShowAppBar title:$title initialUrl:$initialUrl ");
    return WebViewPage(
      showAppbar: isShowAppBar,
      initialUrl: initialUrl,
      arguments: {'title': title},
    );
  }
}
